package org.imis181.moqilintong.model.unary;

import lombok.NoArgsConstructor;

/**
 * 计算一个数的立方
 * @author moqilintong
 */
@NoArgsConstructor
public class Cube01 extends AbstractUnaryOperation01 {
    public Cube01(double oprand) {
        super(oprand);
    }

    @Override
    public double getResult() {
        return super.oprand * super.oprand * super.oprand;
    }

    @Override
    public String toString() {
        String template = "(%f)^3 = %f";
        return String.format(template, super.oprand, getResult());
    }
}
